<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登陆</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<style>
			#a{
				width: 800px;
				height: 500px;
				background-image: url(picture/chaoshi.jpg);
			}
			#app{
				padding-left: 220px;
				padding-top: 10px;
				width: 450px; 
			}
		</style>
		<script src="js/axios.min.js"></script>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="a">
			<h1 style="padding-left: 200px;padding-top: 80px;">特美好超市管理系统</h1>
		<div id="app">
			<h2>登录</h1>
			<div class="form-group">
				<label for="username">用户名：</label>
				<input type="text" class="form-control"  v-model="username"
				 placeholder="请输入用户名..." autocomplete="off"
				  autofocus="autofocus"/>
			</div>
			<div class="form-group">
				<label for="password">密码：</label>
				<input type="password"class="form-control" v-model="password"
				 placeholder="请输入密码..."autocomplete="off"
				 autofocus="autofocus"/>
			</div>
			<div class="form-group">
				<button class="btn btn-primary"
				v-on:click="dologin()">登陆</button>
				<button class="btn btn-danger" style="margin-left: 20px;" onclick="doregister()">注册</button>
			</div>
			<div class="mes"></div>
		</div>
		</div>
	</body>
	<script>
		var config={
			el:"#app",
			data:{
				username:null,
				password:null
			},
			methods:{
				dologin:function(){
					var serverUrl="http://localhost:8088/admin/login/"+this.username+"/"+this.password;
					console.log(serverUrl);
					axios.get(serverUrl)
					.then(function(response){
						console.log(response.data.message)
							window.alert("登陆ok");
							location.href="index.html";
						
					})
					.catch(function(e){
						window.alert(e.message)
						console.log(e);
					})
				}
			}
		}
		var vue =new Vue(config);
		function doregister(){
			location.href="register.html"
		}
	</script>
</html>
